BEGIN {
    FS="|";
    srand();
}
{
    choice_qt=NF-1;
    for(i=0; i<choice_qt; i++)  aAnswer[i]=0;
    i=0;
    while(i<choice_qt)
    {
        ind=int(rand()*choice_qt);
        if(aAnswer[ind]==0)
        {
            aAnswer[ind]=i+1;
            i++;
        }
    }
    printf("insert into question values(question_seq.nextval,'%s',%d);\n",\
           $1,aAnswer[0]);
    for(i=0; i<choice_qt; i++)
    {
        printf("insert into answer values(question_seq.currval,%d,'%s');\n",\
               aAnswer[i],$(i+2));
    }
}
